import java.util.Scanner;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 87111
 * Date: 2025-05-15
 * Time: 15:34
 */
public class test1 {
    public static void main(String[] args) {
        // 计算一只青蛙从地面跳到指定高度 n 的台阶有多少种不同的跳跃方式。青蛙每次可以选择跳 1 级或者2 级台阶直到达到目标高度。
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        System.out.println(on(n));
    }
    public static int on(int n) {
        if(n == 1) {
            return 1;
        }
        if(n == 2) {
            return 2;
        }
        return on(n-1) + on(n-2);
    }

    public static void main12(String[] args) {
        //在同一个类中,分别定义求两个整数的方法 和 三个小数之和的方法。
        System.out.println(addThree(10,20));
        System.out.println(addThree(1.1,2.2,3.3));
    }
    public static int addThree(int a,int b) {
        return a + b;
    }
    public static double addThree(double a,double b,double c) {
        return a + b + c;
    }

    public static void main11(String[] args) {
        //创建方法求两个数的最大值max2，随后再写一个求3个数的最大值的函数max3。
        //要求：在max3这个函数中，调用max2函数，来实现3个数的最大值计算
        System.out.println(max2(10,20));
        System.out.println(max3(10,20,30));
    }
    public static int max2(int a,int b) {
        return Math.max(a,b);
    }
    public static int max3(int a,int b,int c) {
        int max = max2(a,b);
        return max2(max,c);
    }

    public static void main10(String[] args) {
        //写一个递归方法，输入一个非负整数，返回组成它的数字之和
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        System.out.println(addTwo(a));
    }
    public static int addTwo(int a) {
        if(a < 10) {
            return a;
        }
        return a % 10 + addTwo(a / 10);
    }

    public static void main9(String[] args) {
        //递归求解汉诺塔问题
        Scanner sc = new Scanner(System.in);
        //输入A柱子上的圆环数
        int count = sc.nextInt();
        char a = 'A';
        char b = 'B';
        char c = 'C';
        way(count,a,b,c);
    }
    public static void way(int count,char a,char b,char c) {
        if(count == 1) {
            System.out.println(a + "->" + c);
        }else {
            way(count-1,a,c,b);
            System.out.println(a + "->" + c);
            way(count-1,b,a,c);
        }
    }

    public static void main8(String[] args) {
        //递归求斐波那契数列的第 N 项
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        System.out.println(fibOne(n));
    }
    public static int fibOne(int n) {
        if(n == 1||n == 2) {
            return 1;
        }
        return fibOne(n-1) + fibOne(n-2);
    }

    public static void main7(String[] args) {
        //按顺序打印一个数字的每一位(例如 1234 打印出 1 2 3 4)（递归）
        print(1234);
    }
    public static void print(int a) {
        if(a < 10){
            System.out.print(a);
            return;
        }
        print(a / 10);
        System.out.print(a % 10);
    }

    public static void main6(String[] args) {
        //递归求 1 + 2 + 3 + ... + 10
        System.out.println(addOne(10));
    }
    public static int addOne(int n){
        if(n == 1) {
            return 1;
        }
        return n + addOne(n-1);
    }

    public static void main5(String[] args) {
        //递归求 N 的阶乘
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        System.out.println(arr(n));
    }
    public static int arr(int n){
        if(n == 0){
            return 1;
        }
        return n * arr(n-1);
    }

    public static void main4(String[] args) {
        //在同一个类中定义多个方法：要求不仅可以求2个整数的最大值，还可以求3个小数的最大值？
        System.out.println(maxNumber(10,20));
        System.out.println(maxNumber(1.1,2.2,3.3));
    }
    public static int maxNumberOne(int a,int b) {
        return Math.max(a,b);
    }

    public static int maxNumber(int a,int b){
        int max = a;
        if(max < b){
            max = b;
            return max;
        }
        return max;
    }
    public static double maxNumber(double a,double b,double c) {
        if(a < b){
            if(b < c){
                return c;
            }else{
                return b;
            }
        }else if(a < c){
            return c;
        }else{
            return a;
        }
    }
    public static void main3(String[] args) {
        //求斐波那契数列的第n项。(迭代实现)
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        System.out.println(fibN(n));
    }
    public static int fibN(int n){
        int a = 1;
        int b = 1;
        int c = 2;
        if(n == 1||n == 2){
            return 1;
        }
        for (int i = 3; i < n; i++) {
            a = b;
            b = c;
            c = a + b;
        }
        return c;
    }

    public static void main2(String[] args) {
        //求n的阶乘
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        System.out.println(fib(n));
    }
    public static int fib(int a){
        if(a == 1){
            return 1;
        }
        return a * fib(a-1);
    }
    public static void main1(String[] args) {
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        boolean b = isPrimeNumber(a);
        if (b == true) {
            System.out.println(a + "是素数");
        }
    }
    public static int add(int a,int b){
        return a + b;
    }
    public static double add(double a,double b){
        return a + b;
    }

    public static boolean isPrimeNumber(int n) {
        for (int i = 2; i < Math.sqrt(n); i++) {
            if (n % i == 0) {
                return false;
            }
        }
        return true;
    }
}